home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 12.8 KB | 379 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: MSWorks.vu
- #
- # Contains: Quick look test script for Microsoft Works version 3.0
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","Print.Lib","UserInterface.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: KA
- # Description: Sets up tools and fonts for Microsoft Works . This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
- global kToolPaletteNum := 1;
- global kPatternPaletteNum := 2;
- global kLinePaletteNum := 3;
- global kColorPaletteNum := 4;
- global kGradientPaletteNum := 0;
-
- global gWindowInset := {0,64,20,20}; # Window inset
- global gScreenInset := {0,42,0,0}; # Screen inset
- global gVoidRect := {}; # Rect not to draw in - coordinates should be RelativeToWindow
- global gTextStr;
-
- global gPaletteList := {
- { #### Start Palette # - Draw tools
- {1, 16}, # Specifier/HeaderHieght
- kPalWind, # Palette type
- {2,12}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {30,18} # Offset between tools {h,v}
- }, #### End Palette #
- { #### Start Palette # - Pattern
- {15,190,-255,181,1}, # PopPoint/TopLeft/Windspecifier
- kPopUpPal, # Palette type
- {16,4}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {16,16} # Offset between tools {h,v}
- }, #### End Palette #
- { #### Start Palette # - Line
- {52,190,-89,182,1}, # PopPoint/TopLeft/Windspecifier
- kPopUpPal, # Palette type
- {10,10}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {13,13} # Offset between tools {h,v}
- }, #### End Palette #
- { #### Start Palette # - Color
- {23,209,-319,200,1}, # PopPoint/TopLeft/Windspecifier
- kPopUpPal, # Palette type
- {32,8}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {10,10} # Offset between tools {h,v}
- } #### End Palette #
- };
-
- ### Works {Flag, Pattern, Line, Color}
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global Pointer := { 9, 1, "Pointer", kClick, 0, {0} };
- global LineTool := { 10, 1, "Line", kDrag, 0, {1,1,1,1} };
- global CharTool := { 11, 1, "Char", kClick, 0, {gTextStr} };
- global ParagraphTool := { 12, 1, "Paragraph",kDrag, 0, {gTextStr} };
- global RndRectTool := { 13, 1, "RndRect", kDrag, 0, {1,1,1,1} };
- global RectTool := { 14, 1, "Rect", kDrag, 0, {1,1,1,1} };
- global OvalTool := { 15, 1, "Oval", kDrag, 0, {1,1,1,1} };
- global MultiLine := { 16, 1, "MultiLine",kMultiClick,1, {1,1,1,1} };
- global ArcTool := { 17, 1, "Arc", kDrag, 0, {1,1,1,1} };
- global FreeTool := { 18, 1, "Freehand", kMultiDrag, 0, {1,1,1,1} };
-
- # global Tool list
- global gToolList:={
- Pointer,
- LineTool,
- CharTool,
- ParagraphTool,
- RndRectTool,
- RectTool,
- OvalTool,
- MultiLine,
- ArcTool,
- FreeTool
- };
-
- ### font characteristic lists
- global gFontSizeList := {'9','10','12','14','18'};
- global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- end; #InitAppGlobals
-
- #########################################################################
- # NewWorksDoc()
- #========================================================================
- # Author: KTA
- # Description: Select Icon and type return in Works' SF_Get
- # Parameters: None
- # Returns: Nada
- # Examples: NewWorksDoc();
- # Assumptions: Works
- #========================================================================
- # History:
- #
- #########################################################################
- task NewWorksDoc(whichType, SelectOpen := 0)
- begin
- dialogcheck('No terminal tool',1);
- If(SelectOpen)
- begin
- SelectMenuItem('Open','File');
- Wait(2);
- end;
-
- if(match[button t:'Desktop'])
- begin
- AllTypes := {56,51};
- WordProcessor := {123,51};
- DataBase := {177,51};
- SpreadSheet := {230,51};
-
-
- if (whichType = 'AllTypes')
- moveRelativeToWindow(AllTypes[1],AllTypes[2],1,2,0,1);
- else if (whichType = 'WordProcessor')
- moveRelativeToWindow(WordProcessor[1],WordProcessor[2],1,2,0,1);
- else if (whichType = 'DataBase')
- moveRelativeToWindow(DataBase[1],DataBase[2],1,2,0,1);
- else if (whichType = 'SpreadSheet')
- moveRelativeToWindow(SpreadSheet[1],SpreadSheet[2],1,2,0,1);
-
- LogStr("Selected the ∂'{whichType}∂' icon on Works∂' StandardFiled dialog");
- #SelectButton('New');
- SpecialKey(returnkey,'Return key');
- end;
- else
- Println "Sorry, but Works' StandardFile is not present";
- end;
-
-
- #########################################################################
- # NumberCalc()
- #========================================================================
- # Author: KTA
- # Description: Enters in a numbers to be used in a simple speadsheet
- # calculation.
- # Parameters: None
- # Returns: Nothing
- # Examples: NumberCalc();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task NumberCalc() begin
- numbersList :={"=sum(b2:b6)",40,30,20,10,1000};
- SpecialKey( rightarrowkey, "RightArrow Key");
- TypeList(NumbersList,4,1);
- end;
-
- #########################################################################
- # TextLabels()
- #========================================================================
- # Author: KTA
- # Description: Enters in a Labels to be used in a simple speadsheet
- # calculation.
- # Parameters: None
- # Returns: Nothing
- # Examples: TextLabels();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task TextLabels() begin
- textList :={"Quarterly Earnings","Mortgage", "Paper", "Utilities", "Garbage", 'Phone', 'Total'};
- TypeList(textList,1);
- end;
-
-
- #########################################################################
- # WorkSSEx()
- #========================================================================
- # Author: KTA
- # Description: Sets up a simple speadsheet calculation test.
- # Parameters: None
- # Returns: Nothing
- # Examples: WorkSSEx();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task WorkSSEx() begin
- LogStr("Begining data entry for Work Spreadsheet example",3);
- NewWorksDoc('SpreadSheet',1);
-
- TextLabels();
- NumberCalc();
- LogStr("Entered some data and performed a calculation",3);
- println;
- end;
- #########################################################################
- # DBSetup()
- #========================================================================
- # Author: KTA
- # Description: Enters Field names into Works DateBase
- # Parameters: none
- # Returns: Nothing
- # Examples: DBSetup();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task DBSetup()
- begin
- TypeList({'Name', 'Address', 'City', 'State', 'Zip', 'Phone', 'Birth Date'},1,1); # Each item followed by a returnkey
-
- selectButton('Done');
- println;
- end;
- #########################################################################
- # WorkDBEx()
- #========================================================================
- # Author: KTA
- # Description: Sets up a DB example
- # Parameters: none
- # Returns: Nothing
- # Examples: WorkDBEx();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task WorkDBEx()
- begin
- NewWorksDoc('DataBase',1);
- DBSetup();
- DataEntry();
- CloseWindow(1);
- End;
-
- #########################################################################
- # DataEntry()
- #========================================================================
- # Author: KTA
- # Description: Enters Data into Works DateBase
- # Parameters: none
- # Returns: Nothing
- # Examples: DataEntry();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task DataEntry()
- begin
- selectMenuItem("List View","Form"); #change to list view
-
- JohnList := {'John Doe','25 Main St.','San Francisco','CA','95168','657-9876','10-14-58'};
- CalvinList := {'Calvin Hobbes','15680 Beach Blvd.','Santa Cruz','CA','95647','756-6453','03-17-61'};
- WillList := {'Will Clark','1280 Broadway ','Candlestick Park','CA','95637','213-7645','02-11-65'};
- BruceList:= {'Bruce Wayne', '110 First St','Gotham City', 'NJ', '952145', '(423) 456-4675', '09-05-66'};
-
- DataList :={JohnList, CalvinList, WillList, BruceList};
-
- for each item in DataList
- TypeList(item,2,1);
-
- println;
- end;
-
- #########################################################################
- # PageSetupWorks()
- #========================================================================
- # Author: ML
- # Description: Custom Page Setup for Works
- # Parameters: none
- # Returns: Nothing
- # Examples: PageSetupWorks();
- # Assumptions: None
- #========================================================================
- # History:
- #
- ########################################################################
- task PageSetupWorks()
- begin
- PageSetup();
- dialogcheck("The width",1); # handle Works warning if doc width greater than
- # print width
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script Works (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel); # initialize your general globals
- InitDraw();
- InitFonts();
- global gApptitle := "Microsoft Works";
- global gAppVersion := '3'; # version of app you will be running
- SuiteStart('MSWorks.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gFileName := "@!@-{gBuildVers}-Works";
- InitAppGlobals(); # init app specific globals
- (*
- *)
- NewWorksDoc('WordProcessor'); # WordProcessor
- DoSetUpApp(,,,1,1,1);
- DoText();
-
- SelectMenuItem('Draw On', 'Window'); # Drawing
- DoDraw();
- SelectMenuItem('Save','File');
- SelectMenuItem('Hide Tools', 'Window');
-
- WorkSSEx(); # SpreadSheet
- DoWindow();
- CloseWindow(1);
-
- WorkDBEx(); # DataBase
-
- PageSetupWorks();
- DoCloseApp(0,,0);
-
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script Works
-
- ## Still needed
- # 1) A dialog comes up at the first launch (Comm not avail). need - Communication dialogCheck
-
-